this notebook made by :

oussama Yousr : https://www.linkedin.com/in/oussamayousr/

Salah Eddine El Mouslih : https://www.linkedin.com/in/salah-eddine-el-mouslih/

yassine zouhri : https://www.linkedin.com/in/zouhri-yassine/

hamza gaoui : https://www.linkedin.com/in/hamza-gaoui-74a8a0205/

Dataset Upload

Evaluation of deep convolutional neural networks for automatic classification of common maternal fetal ultrasound planes

image.png

Ultrasound (US) examination is an essential tool to monitor fetus and mother along pregnancy, providing an economic and non-invasive way to observe the development of all fetal organs and maternal structures. Several measures obtained from maternal-fetal scans are commonly used to monitor fetal growth

In this Project, We are going to use a large dataset of routinely acquired maternal-fetal screening ultrasound images

All images were manually labeled by an expert maternal fetal clinician. Images were divided into 6 classes: four of the most widely used fetal anatomical planes (Abdomen, Brain, Femur and Thorax), the mother’s cervix (widely used for prematurity screening) and a general category to include any other less common image plane

Unzip the Dataset

The Platform that we are going to use to track our Model Training is W&B

image.png

W&B helps you visualize your model performance and predictions, find the best models fast and share insights learned from your models. Here are a few use cases in which W&B can be specially useful for Kagglers:

Install Weights nad Baises Libraries on Kaggle

Import all the required Libraries

Initialise or track on specific project

Pre-processing and EDA

List Data image on an array

show an image from the dataset

image.png

image.png

load the Dataframe that containes All the information about the Data

image.png

change the Dataframe index

image.png

Reset the Dataframe indexes

image.png

image.png

Our Dataset Classes

shuffle the Dataframe rows

Exploratory Data Analysis

image.png

image.png

image.png

image.png

Split the Data

Validation Data

image.png

Testing data

Training Data

Reset Indexes after Spliting the Data

In this part of the notebook, we have used Two Methode to Generate Data, the first one using Sequence Class in Tensorflow that enable users to costumize their own Data Generators. and the Second method is Data generation using flow_from_dataframe .

load data using tf.keras.utils.Sequence

Image Data generation using Sequence

Image Data Generation using flow_from_dataframe

the First model that we've build is a Baseline model, and Since the is somehow unbalanced, we've tried to Evaluate our models using multiple metrics, F1,Precision, Recall ...

Baseline Model

Plot the model Architecture

Metrics Implementation

Model Training : We have used Adam Optimizer, great Optimizer for Classification Tasks, Then we've used a Learning-rate Decay so we avoid the Stagnation of the model performance during training, for the loss, since we're using the softmax as the activation function of the head Layer and the Labels are hot-encoded we need to use the Categorical_Crossentropy loss for 15 Epochs